<!DOCTYPE html>
<html>
<head>
    <meta content="text/html; charset=UTF-8" http-equiv="content-type">
    <title>iframe</title>
</head>
<body>
<script type="text/javascript">
    var abc= function (){
       var a=123;
    }


    window.parent.postMessage(JSON.stringify({abc:12}),'*')
</script>
</body>
</html>